<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./vue-2.4.0.js"></script>
</head>
<body>
    <div id="app">
        <input type="button" value="button" @click="getelement" ref="mybtn">
        <input type="text">
        <h3 id="myh3" ref="myh3">hello world</h3>
        <!--这是子组件-->
        <login ref="mylogin"></login>
    </div>
    <script>
        var login ={
            template:'<h1>登录组件</h1>',
            data() {
                return {
                    msg:'我是msg'
                }
            },
            methods: {
                show(){
                    console.log('调用了子组件的方法')
                }
            }
        }
        new Vue({
            el:"#app",
            data:{

            },
            methods:{
                getelement(){
                    this.$refs.mybtn
                    console.log('====================================');
                    console.log(this.$refs.mybtn);
                    console.log('====================================');
                    console.log('====================================');
                    console.log(this.$refs.myh3);
                    console.log('====================================');
                    console.log(this.$refs.mylogin.show);
                    console.log(this.$refs.mylogin.msg);
                    
                }
            },
            components:{
                login
            }
        })
    </script>
</body>
</html>